/**
 * 
 */
package helper;

import java.security.MessageDigest;

import com.thoughtworks.xstream.core.util.Base64Encoder;


/**
 * @author Administrator
 *
 */
public class MD5Helper {
	/**
	 * 使用MD5加密字符??
	 * @param code
	 * @return
	 */
	public static String enc(String code){
		try {
			MessageDigest md5 = MessageDigest.getInstance("MD5");
			Base64Encoder base64en = new Base64Encoder();
			String after = base64en.encode(md5.digest(code.getBytes("utf-8")));
			return after;
		} catch (Exception e) {
			throw new RuntimeException("使用MD5加密失败!", e);
		}
	}
}
